package com.qunar.wan.common_api.model.enums;

/**
 * User: tongjie.yang Date: 13-11-26 Time: 上午11:14
 */
public enum Role {

    USER(0, "普通用户"), MANAGER(1, "管理员"), SUPERMANAGER(2, " 超级管理员");

    private String mean;
    private int code;

    private Role(int code, String mean) {
        this.code = code;
        this.mean = mean;
    }

    public String getMean() {
        return mean;
    }

    public int getCode() {
        return code;
    }

    public int code() {
        return this.code;
    }

    public static Role codeOf(int code) {
        for (Role role : values()) {
            if (role.code == code) {
                return role;
            }
        }
        throw new IllegalArgumentException("Invalid role code: " + code);
    }

}
